home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / pdcurs21.zip / PRIVATE.ZIP / _SETROWS.C < prev    next >
Text File  |  1992-11-21  |  3KB  |  97 lines

  1. #define        CURSES_LIBRARY  1
  2. #include <curses.h>
  3.  
  4. #ifndef NDEBUG
  5. char *rcsid__setrows = "$Header: c:/curses/private/RCS/_setrows.c%v 2.0 1992/11/15 03:24:37 MH Rel $";
  6. #endif
  7.  
  8.  
  9.  
  10.  
  11. /*man-start*********************************************************************
  12.  
  13.   PDC_set_rows()       - sets the physical number of rows on screen
  14.  
  15.   PDCurses Description:
  16.        This is a private PDCurses function.
  17.  
  18.        This routine attempts to set the number of rows on the physical
  19.        screen to the passed value.
  20.  
  21.   PDCurses Return Value:
  22.        This function returns OK upon success otherwise ERR is returned.
  23.  
  24.   PDCurses Errors:
  25.        It is an error to attempt to change the screen size on a "bogus"
  26.        adapter.  The reason for this is that we have a known video
  27.        adapter identity problem.  e.g. Two adapters report the same
  28.        identifying characteristics.
  29.  
  30.        It is also an error to attempt to change the size of the Flexos
  31.        console (as there is currently no support for that).
  32.  
  33.   Portability:
  34.        PDCurses        int     PDC_set_rows( int rows );
  35.  
  36. **man-end**********************************************************************/
  37.  
  38. int    PDC_set_rows(int rows)
  39. {
  40. #ifdef FLEXOS
  41.        return( ERR );
  42. #endif
  43. #ifdef DOS
  44.        if (_cursvar.bogus_adapter)
  45.                return( ERR );
  46.  
  47.        switch (_cursvar.adapter)
  48.        {
  49.        case _EGACOLOR:
  50.        case _EGAMONO:
  51.                if (rows < 43)
  52.                        PDC_set_font(_FONT14);
  53.                else
  54.                        PDC_set_font(_FONT8);
  55.                break;
  56.  
  57.        case _VGACOLOR:
  58.        case _VGAMONO:
  59.                if (rows < 28)
  60.                        PDC_set_font(_FONT16);
  61.                else
  62.                if (rows < 50)
  63.                        PDC_set_font(_FONT14);
  64.                else
  65.                        PDC_set_font(_FONT8);
  66.                break;
  67.  
  68.        case _MCGACOLOR:
  69.        case _MCGAMONO:
  70.        case _MDA:
  71.        case _CGA:
  72.        case _MDS_GENIUS:
  73.        default:
  74.                break;
  75.        }
  76.        _cursvar.font = PDC_get_font();
  77.        LINES = PDC_get_rows();
  78.        COLS = PDC_get_columns();
  79.        return( OK );
  80. #endif
  81. #ifdef OS2
  82.        VIOMODEINFO modeInfo;
  83.        USHORT result;
  84.  
  85.        modeInfo.cb = sizeof(modeInfo);
  86.        /* set most parameters of modeInfo */
  87.        VioGetMode(&modeInfo, 0);
  88.        modeInfo.fbType = 1;
  89.        modeInfo.row = rows;
  90.        result = VioSetMode(&modeInfo, 0);
  91.        _cursvar.font = PDC_get_font();
  92.        LINES = PDC_get_rows();
  93.        COLS = PDC_get_columns();
  94.        return ((result == 0) ? OK : ERR);
  95. #endif
  96. }
  97.